package com.testing.class17;

import com.testing.common.AutoTools;
import net.bytebuddy.build.Plugin;
import org.testng.Assert;
import org.testng.annotations.*;

public class DemoNG {

    @BeforeGroups(groups = "will")
    public void beforeGp(){
        System.out.println("分组之前执行的方法");
    }

    @AfterGroups(groups = "roy")
    public void afterGp(){
        System.out.println("分组之后执行的方法");
    }

    @BeforeMethod(groups = "roy")
    public void beforeMethod() {
        System.out.println("DemoNG类中@BeforeMethod方法被执行");
    }

    @AfterMethod(groups = "roy")
    public void afterMethod() {
        System.out.println("DemoNG类中@AfterMethod方法被执行");
    }

    @BeforeClass(groups = "roy")
    public void beforeClass() {
        System.out.println("DemoNG类中@beforeClass方法被执行");
    }

    @AfterClass(groups = "roy")
    public void afterClass() {
        System.out.println("DemoNG类中@afterClass方法被执行");
    }

    @BeforeTest
    public void beforeTest() {
        System.out.println("DemoNG类中@beforeTest方法被执行");
    }

    @AfterTest
    public void afterTest() {
        System.out.println("DemoNG类中@afterTest方法被执行");
    }

    @BeforeSuite(groups = "roy")
    public void beforeSuite() {
        System.out.println("DemoNG类中@beforeSuite方法被执行");
    }

    @AfterSuite(groups = "roy")//(enabled = false)
    public void afterSuite() {
        System.out.println("DemoNG类中@afterSuite方法被执行");
    }

    @Test(priority = 0,groups = "roy")
    public void firstdemo() {
        AutoTools.log.info("这是DemoNG中的第一个测试方法");
        Assert.assertEquals(1,2);
    }

    @Test(priority = 0,groups = "will",dependsOnMethods = {"firstdemo"})
    public void demo() {
        AutoTools.log.info("这是DemoNg中的第二个测试方法");
    }
}
